-
Notifications
You must be signed in to change notification settings - Fork 720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unwrap script validity field in TxBodyContent #3091
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Maybe let Duncan have a look as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good so far, but we have to plumb the flag through to the right place so we can properly have the flag value go back and forth with the underlying ledger tx type (which does contain the flag).
type instance Core.Tx (AlonzoEra c) = ValidatedTx (AlonzoEra c)
data ValidatedTx era = ValidatedTx
{ body :: !(Core.TxBody era),
wits :: !(TxWitness era),
isValidating :: !IsValidating,
auxiliaryData :: !(StrictMaybe (Core.AuxiliaryData era))
}
So as you see, the flag value is directly available.
pattern TxBody txbodycontent <- (getTxBodyContent TxScriptValidityNone -> txbodycontent) | ||
{-# COMPLETE TxBody #-} | ||
|
||
getTxBodyContent :: TxBody era -> TxBodyContent ViewTx era | ||
getTxBodyContent (ByronTxBody body) = getByronTxBodyContent body | ||
getTxBodyContent (ShelleyTxBody era body _scripts _redeemers mAux _scriptValidity) = | ||
fromLedgerTxBody era body mAux | ||
getTxBodyContent :: TxScriptValidity era -> TxBody era -> TxBodyContent ViewTx era | ||
getTxBodyContent _ (ByronTxBody body) = getByronTxBodyContent body | ||
getTxBodyContent scriptValidity (ShelleyTxBody era body _scripts _redeemers mAux _scriptValidity) = | ||
fromLedgerTxBody era scriptValidity body mAux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we would have to add the validity flag into the TxBody
type, probably as an extra field in the ShelleyTxBody
constructor. We have to get the value from the underlying ledger tx type, and not invent it. For one thing we need to do that to have the TxBody round trip test pass, but more importantly we need it to get the right value for the tx from a block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also getAlonzoTxBody
where we extract the parts of the Alonzo.ValidatedTx
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remove the argument of getTxBodyContent
and am taking it from TxBody
.
231f435
to
95e5452
Compare
bors merge |
95e5452
to
528a573
Compare
Canceled. |
e5efa5a
to
31e6c75
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
31e6c75
to
80cf2f1
Compare
bors merge |
Build failed: |
80cf2f1
to
45ce7fd
Compare
bors r+ |
Build failed: |
bors r+ |
Build succeeded: |
No description provided.